<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>libasyncd: ad_http_handler.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">libasyncd
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('ad__http__handler_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">ad_http_handler.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>HTTP protocol request/response handler.  
<a href="#details">More...</a></p>

<p><a href="ad__http__handler_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a6b65a1411892e20395127d00502a2c44"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#a6b65a1411892e20395127d00502a2c44">ad_http_handler</a> (short event, <a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn, void *userdata)</td></tr>
<tr class="memdesc:a6b65a1411892e20395127d00502a2c44"><td class="mdescLeft">&#160;</td><td class="mdescRight">HTTP protocol handler hook.  <a href="#a6b65a1411892e20395127d00502a2c44">More...</a><br/></td></tr>
<tr class="separator:a6b65a1411892e20395127d00502a2c44"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a20357ffbba80b590ad70f451b2ae299e"><td class="memItemLeft" align="right" valign="top">enum <a class="el" href="ad__http__handler_8h.html#a5492f236970d745247b5f5ba47eb9b82">ad_http_request_status_e</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#a20357ffbba80b590ad70f451b2ae299e">ad_http_get_status</a> (<a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn)</td></tr>
<tr class="memdesc:a20357ffbba80b590ad70f451b2ae299e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the request status.  <a href="#a20357ffbba80b590ad70f451b2ae299e">More...</a><br/></td></tr>
<tr class="separator:a20357ffbba80b590ad70f451b2ae299e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9b8117eea824b918f2cc0d80251dfe3a"><td class="memItemLeft" align="right" valign="top">struct evbuffer *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#a9b8117eea824b918f2cc0d80251dfe3a">ad_http_get_inbuf</a> (<a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn)</td></tr>
<tr class="separator:a9b8117eea824b918f2cc0d80251dfe3a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af5085188b8be2e7ab290fe0ec22789b4"><td class="memItemLeft" align="right" valign="top">struct evbuffer *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#af5085188b8be2e7ab290fe0ec22789b4">ad_http_get_outbuf</a> (<a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn)</td></tr>
<tr class="separator:af5085188b8be2e7ab290fe0ec22789b4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa931a4adcd07f3bc23fe4f183dc4c8dc"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#aa931a4adcd07f3bc23fe4f183dc4c8dc">ad_http_get_request_header</a> (<a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn, const char *name)</td></tr>
<tr class="memdesc:aa931a4adcd07f3bc23fe4f183dc4c8dc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get request header.  <a href="#aa931a4adcd07f3bc23fe4f183dc4c8dc">More...</a><br/></td></tr>
<tr class="separator:aa931a4adcd07f3bc23fe4f183dc4c8dc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac07e895997348c2885722f98c3260438"><td class="memItemLeft" align="right" valign="top">off_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#ac07e895997348c2885722f98c3260438">ad_http_get_content_length</a> (<a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn)</td></tr>
<tr class="memdesc:ac07e895997348c2885722f98c3260438"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the size of content from the request.  <a href="#ac07e895997348c2885722f98c3260438">More...</a><br/></td></tr>
<tr class="separator:ac07e895997348c2885722f98c3260438"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a468ef4268a9a7c71dfce494c446ebcb5"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#a468ef4268a9a7c71dfce494c446ebcb5">ad_http_get_content_length_stored</a> (<a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn)</td></tr>
<tr class="memdesc:a468ef4268a9a7c71dfce494c446ebcb5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the actual size of data stored in in-buffer.  <a href="#a468ef4268a9a7c71dfce494c446ebcb5">More...</a><br/></td></tr>
<tr class="separator:a468ef4268a9a7c71dfce494c446ebcb5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4d28e689e120cfa22217507c74683779"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#a4d28e689e120cfa22217507c74683779">ad_http_get_content</a> (<a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn, size_t maxsize, size_t *storedsize)</td></tr>
<tr class="memdesc:a4d28e689e120cfa22217507c74683779"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove content from the in-buffer.  <a href="#a4d28e689e120cfa22217507c74683779">More...</a><br/></td></tr>
<tr class="separator:a4d28e689e120cfa22217507c74683779"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae6a1a9707180447257fd769b249ee42d"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#ae6a1a9707180447257fd769b249ee42d">ad_http_is_keepalive_request</a> (<a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn)</td></tr>
<tr class="memdesc:ae6a1a9707180447257fd769b249ee42d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return whether the request is keep-alive request or not.  <a href="#ae6a1a9707180447257fd769b249ee42d">More...</a><br/></td></tr>
<tr class="separator:ae6a1a9707180447257fd769b249ee42d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a59ed09afcce36474000c6cded0bd7b64"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#a59ed09afcce36474000c6cded0bd7b64">ad_http_set_response_header</a> (<a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn, const char *name, const char *value)</td></tr>
<tr class="memdesc:a59ed09afcce36474000c6cded0bd7b64"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set response header.  <a href="#a59ed09afcce36474000c6cded0bd7b64">More...</a><br/></td></tr>
<tr class="separator:a59ed09afcce36474000c6cded0bd7b64"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a073c5cb0c9724167031e80907890fb88"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#a073c5cb0c9724167031e80907890fb88">ad_http_get_response_header</a> (<a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn, const char *name)</td></tr>
<tr class="memdesc:a073c5cb0c9724167031e80907890fb88"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get response header.  <a href="#a073c5cb0c9724167031e80907890fb88">More...</a><br/></td></tr>
<tr class="separator:a073c5cb0c9724167031e80907890fb88"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afe22e6f81773c01d316e45009996c4a3"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#afe22e6f81773c01d316e45009996c4a3">ad_http_set_response_code</a> (<a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn, int code, const char *reason)</td></tr>
<tr class="separator:afe22e6f81773c01d316e45009996c4a3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a048a0e35599f8a884494deba0dbd89b7"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#a048a0e35599f8a884494deba0dbd89b7">ad_http_set_response_content</a> (<a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn, const char *contenttype, off_t size)</td></tr>
<tr class="separator:a048a0e35599f8a884494deba0dbd89b7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa54a1f3393b20b70f2769b3d039f3bd7"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#aa54a1f3393b20b70f2769b3d039f3bd7">ad_http_response</a> (<a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn, int code, const char *contenttype, const void *data, off_t size)</td></tr>
<tr class="separator:aa54a1f3393b20b70f2769b3d039f3bd7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9067ac0cfb15136e63c134a5292e7716"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#a9067ac0cfb15136e63c134a5292e7716">ad_http_send_header</a> (<a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn)</td></tr>
<tr class="separator:a9067ac0cfb15136e63c134a5292e7716"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5be41fc8a08dcadf94fc271aeb05b6e2"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#a5be41fc8a08dcadf94fc271aeb05b6e2">ad_http_send_data</a> (<a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn, const void *data, size_t size)</td></tr>
<tr class="separator:a5be41fc8a08dcadf94fc271aeb05b6e2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a515f6b88b99a19e5c0ccdfd43b0e29ad"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#a515f6b88b99a19e5c0ccdfd43b0e29ad">ad_http_send_chunk</a> (<a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *conn, const void *data, size_t size)</td></tr>
<tr class="separator:a515f6b88b99a19e5c0ccdfd43b0e29ad"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afeef7409bd771bcf2e29eb6ab70af894"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ad__http__handler_8c.html#afeef7409bd771bcf2e29eb6ab70af894">ad_http_get_reason</a> (int code)</td></tr>
<tr class="separator:afeef7409bd771bcf2e29eb6ab70af894"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>HTTP protocol request/response handler. </p>

<p>Definition in file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a6b65a1411892e20395127d00502a2c44"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ad_http_handler </td>
          <td>(</td>
          <td class="paramtype">short&#160;</td>
          <td class="paramname"><em>event</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>userdata</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>HTTP protocol handler hook. </p>
<p>This hook provides an easy way to handle HTTP request/response.</p>
<dl class="section note"><dt>Note</dt><dd>This hook must be registered at the top of hook chain.</dd></dl>
<div class="fragment"><div class="line"><a class="code" href="structad__server__s.html">ad_server_t</a> *server = <a class="code" href="ad__server_8c.html#a677263079eb999133e9a0be48dd2cba5">ad_server_new</a>();</div>
<div class="line"><a class="code" href="ad__server_8c.html#aeb61485fd4f4e2f13c93871558b58025">ad_server_register_hook</a>(server, <a class="code" href="ad__http__handler_8c.html#a6b65a1411892e20395127d00502a2c44">ad_http_handler</a>, NULL);</div>
</div><!-- fragment --> 
<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00084">84</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="a20357ffbba80b590ad70f451b2ae299e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="ad__http__handler_8h.html#a5492f236970d745247b5f5ba47eb9b82">ad_http_request_status_e</a> ad_http_get_status </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return the request status. </p>

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00116">116</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="a9b8117eea824b918f2cc0d80251dfe3a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct evbuffer* ad_http_get_inbuf </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00123">123</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="af5085188b8be2e7ab290fe0ec22789b4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct evbuffer* ad_http_get_outbuf </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00128">128</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="aa931a4adcd07f3bc23fe4f183dc4c8dc"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char* ad_http_get_request_header </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get request header. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>name of header.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>value of string if found, otherwise NULL. </dd></dl>

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00140">140</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="ac07e895997348c2885722f98c3260438"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">off_t ad_http_get_content_length </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return the size of content from the request. </p>

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00148">148</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="a468ef4268a9a7c71dfce494c446ebcb5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t ad_http_get_content_length_stored </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return the actual size of data stored in in-buffer. </p>

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00157">157</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="a4d28e689e120cfa22217507c74683779"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void* ad_http_get_content </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>maxsize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>storedsize</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Remove content from the in-buffer. </p>
<p>The return data gets null terminated for convenience. For an example, if it reads 3 bytes, it will allocate 4 bytes and the 4th byte will be set to null terminator. <code>storedsized</code> will still return 3.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">maxsize</td><td>maximum length of data to read. 0 to read everything. </td></tr>
    <tr><td class="paramname">storedsize</td><td>the size of data read and stored in the return. </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00172">172</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="ae6a1a9707180447257fd769b249ee42d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ad_http_is_keepalive_request </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return whether the request is keep-alive request or not. </p>
<dl class="section return"><dt>Returns</dt><dd>1 if keep-alive request, otherwise 0. </dd></dl>

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00199">199</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="a59ed09afcce36474000c6cded0bd7b64"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ad_http_set_response_header </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set response header. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>name of header. </td></tr>
    <tr><td class="paramname">value</td><td>value string to set. NULL to remove the header.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success, -1 if we already sent it out. </dd></dl>

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00231">231</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="a073c5cb0c9724167031e80907890fb88"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char* ad_http_get_response_header </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get response header. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>name of header.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>value of string if found, otherwise NULL. </dd></dl>

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00254">254</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="afe22e6f81773c01d316e45009996c4a3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ad_http_set_response_code </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>code</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>reason</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>0 on success, -1 if we already sent it out. </dd></dl>

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00263">263</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="a048a0e35599f8a884494deba0dbd89b7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ad_http_set_response_content </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>contenttype</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">off_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">size</td><td>content size. -1 for chunked transfer encoding. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success, -1 if we already sent it out. </dd></dl>

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00281">281</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="aa54a1f3393b20b70f2769b3d039f3bd7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t ad_http_response </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>code</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>contenttype</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">off_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>total bytes sent, 0 on error. </dd></dl>

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00308">308</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="a9067ac0cfb15136e63c134a5292e7716"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t ad_http_send_header </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>0 total bytes put in out buffer, -1 if we already sent it out. </dd></dl>

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00331">331</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="a5be41fc8a08dcadf94fc271aeb05b6e2"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t ad_http_send_data </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>0 on success, -1 if we already sent it out. </dd></dl>

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00367">367</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="a515f6b88b99a19e5c0ccdfd43b0e29ad"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t ad_http_send_chunk </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ad__server_8h.html#a13ab8ad0b151e6b08c548bb36daef631">ad_conn_t</a> *&#160;</td>
          <td class="paramname"><em>conn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00394">394</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
<a class="anchor" id="afeef7409bd771bcf2e29eb6ab70af894"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char* ad_http_get_reason </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>code</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="ad__http__handler_8c_source.html#l00428">428</a> of file <a class="el" href="ad__http__handler_8c_source.html">ad_http_handler.c</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="ad__http__handler_8c.html">ad_http_handler.c</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>
